import { getIP } from "./src/main/apis/remoteIp";
import CommentHelper from "./src/main/commentHelper";

const main = async () => {
    // const userId = '865484597';
    // const passToken = 'ChNwYXNzcG9ydC5wYXNzLXRva2VuErAB6b4zLeqTugoEzdNZps812rNPHwaDdJ2bTAn-4HvN2fDLbN9mBbbl3_j2fbOnmKoPIPTajV1kOmnfpASt34IeueRmkKgxE8QcilecPnGcAXO1LxWQ5Bh0sNzC1ue3K4LKl_OH9t3ZrdiJ-jaCqB4SmBS325MfFd3Kw3QHapT6CCAJh9B0-iLhM_TBI-3w5wzwrcl-gu1KUu3GlacMFDHQ9f2opm0DvpaPlbVeJjYPlW4aEkUB92WLBka4nta_YJgRFstsyiIgRGFPX4lSwyKO2jOeCNyoc5FZtVd_wg0Ju_eITg7B5oYoBTAB'
    const userId = '2684097491';
    const passToken = 'ChNwYXNzcG9ydC5wYXNzLXRva2VuEpABDomuB4kHVQsWFkGbn4u7HC0UWY9k52RUARZzdPW3h5GRdXczAb2gi3A16Xs5sJ9zuGNT_lPyxlIdeF-SpLnyA-fCUr0B_CxsEo7Gn7vDnwTgvlg5keoirDzU_ozuh37AxQ_Q-draChJgWAyfBT9GbYkhwlTUqHsc3crnpJqTcUXY9AJ6PhGYGUttE5UjxcvQGhKKuu7N4whAZLzzxMcR5srWdDAiIElslAFFMYOKXKeReB6scRu5JubbUldZf8OeOW8Dt_JuKAUwAQ'
    
    const commentHelper = new CommentHelper();
    const ip = await getIp();
    if (ip) {
        commentHelper._ip = ip;
        console.log(ip)
        console.log('代理。。。');
    }
    await commentHelper.initCookies2(userId, passToken);
    await commentHelper.commentWorks('3xcsvwg5xx4apwq', '您好');
};

const getIp = async () => {
    try {
        const ipRes = await getIP(1);
        if (ipRes.data.code === 200) {
          const ipObj = ipRes.data.data[0];
          // ipObj.ip  ipObj.port
          return ipObj; //`${ipObj.ip}:${ipObj.port}`;
        }
    } catch (error) {
        console.log(error);
    }
    return null;
}
// getIp();
main();























// 